package com.ccc.scala.base7_collection

object Collection11_Set {

  def main(args: Array[String]): Unit = {
    // 不可变 set
    val set1 = Set(1, 2, 3, 4, 3, 2, 1)
    val set2 = Set(5, 6, 7, 8)
    println(set1) // Set(1, 2, 3, 4)
    println(set2) // Set(5, 6, 7, 8)

    // 增加数据
    val set3 = set1 + 5 + 6
    val set4 = set1.+(9, 10, 7)
    println(set3) // Set(5, 1, 6, 2, 3, 4)
    println(set4) // Set(10, 1, 9, 2, 7, 3, 4)

    // 删除数据
    val set5 = set1 - 1 - 2
    println(set5) // Set(3, 4)





  }

}
